#include <stdio.h>
#include <stdlib.h>
char str[25];
char st[20];
int top=-1;
int main()
{
 gets(str);
 int len=0,count=0;
 for(int i=0;str[i]!='\0';i++)
 {
  if(str[i]!='('&&str[i]!=')')
  len++;
 }
 for(int i=0;str[i]!='\0';i++)
 {
  if(str[i]=='(')
  {
   st[++top]=str[i];
  } 
  else if(str[i]=='*'||str[i]=='/')
  {
   while(top>-1&&(st[top]=='*'||st[top]=='/'))
   {
    printf("%c",st[top--]);
    count++;
    if(count!=len)
     printf(" ");
   }
   st[++top]=str[i];
  }
  else if(str[i]=='+'||str[i]=='-')
  {
   if(i==0||(i>0&&str[i-1]=='(') )
   {
    if(str[i]=='+')
    {
     count++;
    }
    else
    {
     printf("%c",str[i]);
     count++;
    } 
    continue;
   }
   while(top>-1&&st[top]!='(')
   {
    printf("%c",st[top--]);
    count++;
    if(count!=len)
     printf(" ");
   }
   st[++top]=str[i];
  }
  else if(str[i]==')')
  {
   while(st[top]!='(')
   {
    printf("%c",st[top--]);
    count++;
    if(count!=len)
     printf(" ");
   }
   top--;
  }
  else
  {
   printf("%c",str[i]);
   count++;
   if(count!=len&&(str[i+1]<'0'||str[i+1]>'9')&&str[i+1]!='.')
    printf(" ");
  }
 } 
 while(top!=-1)
 {
  printf("%c",st[top--]);
  count++;
  if(count!=len)
   printf(" ");
 }
 return 0;
} 
